Repository navigation
fix(cloud-connection): install-local answers an artifact the resolver refuses with its 422 at the declared-rename step, not a 503 - #34573
Conversation
…fact resolver refuses with that refusal, not the unread-table 503 Claude-Session: https://claude.ai/code/session_01ADHkmRXuRn93HphKp7kXEz Co-authored-by: Claude <noreply@anthropic.com>
…34432 route pins Claude-Session: https://claude.ai/code/session_01ADHkmRXuRn93HphKp7kXEz Co-authored-by: Claude <noreply@anthropic.com>
…olver refusal; name the runtime the pins run over Claude-Session: https://claude.ai/code/session_01ADHkmRXuRn93HphKp7kXEz Co-authored-by: Claude <noreply@anthropic.com>
…the rename plan once the bodies resolved Claude-Session: https://claude.ai/code/session_01ADHkmRXuRn93HphKp7kXEz Co-authored-by: Claude <noreply@anthropic.com>
…stall-local-resolver-refusal
📓 Docs Drift CheckThis PR changes 1 package(s): 1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
What this run could not see
Coarse fallback — 7 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 370e21ad47acc78d567d7f070cfe02e7e7647452 && git checkout 370e21ad47acc78d567d7f070cfe02e7e7647452
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 1e4656d01fe485935c493a00ecdb8e0f8a0fed55 18b604942f7eb7d7c6c297ec09078a94d1f6325a && git checkout -B drift-repro 1e4656d01fe485935c493a00ecdb8e0f8a0fed55 && git merge --no-ff 18b604942f7eb7d7c6c297ec09078a94d1f6325a
node scripts/docs-audit/affected-docs.mjs --json 1e4656d01fe485935c493a00ecdb8e0f8a0fed55
|
|
repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz Final head for review: |
|
repo:objectstack#2 · os-steve · session_01ADHkmPZf3MhxKeGaxV4P3W 席位核对L1 first review · ACCEPT · head Checklist (read on GitHub at this head, not from the report)
Out of scope, for the area to place (one line each:
|
|
repo:objectstack#2 · os-steve · session_01ADHkmRXuRn93HphKp7kXEz Landing
Dispositions asked by the L1 review: the installed-copy side of the pre-resolution (misattributed refusal message, no pin) is filed: #34583; the dependency-cycle 500 is filed: #34574. Both are in the body's Acceptance notes. State: ready, auto-merge armed. |
Requested by Steve · project thread
Fixes #34432
Clause-②: no
Metadata-protocol: none
维护者速读
packages不是数组、或某个包条目带已退役的indexes[].unique: true)时,改为回答解析器自己的 422 与错误码,不再回答 503「数据库不可用、请重试」。@objectstack/cloud-connection一个文件的拒收答复,不写入任何数据;真正读不到表时仍回 503;未声明状态的异常(如包之间的依赖环)原样抛出。回滚即还原本 PR。packages/cloud-connection/src/marketplace-install-local-plugin.ts的evaluateDeclaredRenames开头新增的预解析块,以及抽出的declaredRefusalAnswer(2b 与 2c″ 共用);再看新测试marketplace-install-local-resolver-refusal-34432.test.ts。pnpm --filter @objectstack/cloud-connection exec vitest run src/marketplace-install-local-resolver-refusal-34432.test.ts,预期 5 个用例全绿(两条 422、一条 503 对照、一条 200 对照、一条依赖环原样抛出)。What changes
Step 2c″ of
POST /api/v1/marketplace/install-local(evaluateDeclaredRenames) caught every throw out ofplanDeclaredRenamesand answered it503 SERVICE_UNAVAILABLE"… could not be read … Retry once the database answers". That included the artifact resolver's declared422refusal of a composed body. The step now:packageUpgradeSideOf: theresolveStackCollectionreads ofobjects,objectExtensionsanddata; the installed body too on a re-install);422 INVALID_ARTIFACT_PACKAGES/INVALID_ARTIFACT_PACKAGE_ENTRY) and writes nothing;Error), and does not relabel it;503for a throw out of the plan itself, which is now only the table read.The reader is the one step 2b (#34428) answers the same refusal with. It is extracted within the file as
declaredRefusalAnswer(manifestId, err), so the two steps share one implementation and answer the same bytes with the same status, code and sentence. Step 2b's behaviour is byte-identical: same predicate (declaredStatus === undefined || status >= 500⇒ rethrow), same body, same status.Changeset:
@objectstack/cloud-connectionpatch.Tests
New file
packages/cloud-connection/src/marketplace-install-local-resolver-refusal-34432.test.ts. It drives the real install route handler, under thesingleposture, with the route-handler harness that #34428 used (runtime mocked without the step-1c collectors):packages: 'not-a-list'⇒422,error.codeINVALID_ARTIFACT_PACKAGES. Nothing is registered, there is no ledger entry, and the driver is never asked to read a table.indexes[].unique: true⇒422,INVALID_ARTIFACT_PACKAGE_ENTRY. Nothing is written.503 SERVICE_UNAVAILABLE, and nothing is written.200.503.No existing test was changed.
Ablation (fix removed ⇒ red), via scripts/ablation-replace.mjs
Mutation:
packageUpgradeSideOf(converted);⇒/* ABLATION-34432 */inmarketplace-install-local-plugin.ts, at commit e6e6b07. The anchor count went 1 ⇒ 0 and the blob went 8302cb31cf1b ⇒ 07061200e185. The test imports the plugin by relative path (source, notdist/), so no rebuild sits in the loop.Tests 3 failed | 2 passed (5): both 422 pins received503 SERVICE_UNAVAILABLEwith the card's exact sentence ("the tables its declared rename(s) carry could not be read (A release artifact'spackagesmust be an array …) … Retry once the database answers."). The cycle pin received the503answer ("… could not be read ([Kernel] Circular dependency detected: com.example.suite.core) …") and no throw.blob after restore 8302cb31cf1b == blob at HEAD, andgit diff HEADis empty.Package suite and typecheck at the final head
After the closure rebuild (
pnpm --filter '@objectstack/cloud-connection...' build) at 18b6049:pnpm --filter @objectstack/cloud-connection typecheck: exit 0.tsconfig.test.json --listFilesincludes the new test file.pnpm --filter @objectstack/cloud-connection exec vitest run --maxWorkers=2:Test Files 89 passed (89),Tests 1295 passed (1295).VERDICT command-exit 0.Acceptance notes
@objectstack/runtimewithoutcollectJobsWithoutBody/collectHooksWithoutBody. That stands for a runtime that predates the step-1c code judgements, and on such a runtime 2c″ is the first step to resolve the packages. With the real runtime the same two bodies are resolved first at step 1c (unrunnableCode⇒collectBundleJobs⇒resolveArtifactCollections), and the resolver's refusal leaves the handler as a throw. I measured this by running the same pins once over the real runtime: the throw comes out ofhandleInstallat thecollectJobs(manifest)call. The Hono transport's error seam (declaredEnvelopeForThrow) then answers it422with the resolver's code and reports a transport escape. That last part is read fromplugin-hono-server/src/adapter.ts, not measured. So on a current runtime the client already saw the422, and this PR changes the 2c″ answer for the older-runtime composition. Step 1c answering the refusal itself, as 2b and now 2c″ do, is outside this card.planDeclaredRenamesafter the bodies resolved is answered as the table read. That is the driver's introspection, plus any fault of the plan's own code, which this step has always answered503. Telling those two apart needs a marker at the driver call insidemarketplace-install-declared-renames.ts, which is outside this card's file surface.data, which the plan alone does not read. A composed body the resolver refuses only throughdatais now refused here, before any write. Before, themanifestservice refused it at register, on the same bytes.ErrorbyresolveArtifactPackageOrder's documented contract (artifact-collections.tsheader). It is rethrown here and, by the transport seam, answered500 INTERNAL_ERRORwith no cause. Filed: install-local: a composed artifact with a package dependency cycle answers an opaque 500 instead of naming the cycle #34574.packageUpgradeSideOf(installed)). When today's resolver refuses that stored copy, the answer is a 422 that names the incoming package ("Package 'X' cannot be installed"), and that side has no pin of its own. Before this PR the same case answered 503, and step 2c′ folds the installed copy again unguarded, so this is no new dead end, only a misattributed message. Filed: install-local reinstall: a refused installed copy is reported as "Package 'X' cannot be installed", blaming the incoming package #34583.Verification
Gates were run after the last commit, one at a time, each with stdin closed. The derived list is
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat 18b6049 (3 paths, 71 commands). Reconciliation is--ranwithRun reconciliation — 71 derived, 71 run, 0 NOT-MEASURED, 0 UNRUN..Gate results
All 71 exit 0.
check:dual-build-cjs-loadsfirst answered exit 3 (PREREQUISITE NOT MET, nodist/) and was re-run green after a whole-workspace build (turbo run build --filter=!@objectstack/docs --concurrency=2, lock VERDICT command-exit 0):124 published require entry point(s) across 72 package(s) load.